package router

import (
	"longmen/server/internal/api"

	"github.com/labstack/echo/v4"
)

func initPublicRoute(group *echo.Group, base api.Controller, authFunc echo.MiddlewareFunc) {
	group.POST("/search", base.SearchLiveOrAnchor, authFunc)    //搜索
	group.POST("/insearch", base.SearchLiveOrAnchor, authFunc)  //兼容旧版本
	group.POST("/captcha", base.Captcha)                        //搜索
	group.POST("/captcha_path", base.CaptchaPath)               //搜索
	group.POST("/captcha_verify", base.CaptchaVerify)           //搜索
	group.POST("/maintain", base.Maintain)                      //维护
	group.POST("/qcloud_sts", base.GetTempKeysForCos, authFunc) //腾讯存储

	//ip
	group.POST("/ip/search", base.IpToArea)
	group.POST("/ip/astrict_area", base.AstrictArea)

	//协议
	group.POST("/protocol/getProtocolList", base.GetProtocolList)
	group.POST("/protocol/getProtocolById", base.GetProtocolById)

	//域名检测
	group.Any("/domain/check", base.CheckDomian)

	//新闻
	group.POST("/news/getNewsList", base.GetNewsList)
	group.POST("/news/getNews55LiveList", base.Get55LiveNewsList)
	group.POST("/news/getNewsById", base.GetNewsById)
	group.POST("/news/getNewsCategoryList", base.GetNewsCategoryList)
	group.POST("/news/getNewsBannerList", base.GetNewsBannerList)
	group.POST("/news/getRecommenedNewsList", base.GetRecommenedNewsList)

	//底部链接
	group.POST("/links/getLinksList", base.GetLinks)

	//公告
	group.POST("/announcement/getAnnouncementList", base.GetAnnouncementList)
	group.POST("/announcement/getAnnouncement", base.GetAnnouncement)
	group.POST("/announcement/getLastAnnouncement", base.GetLastAnnouncement)

	//系统消息
	group.POST("/notice/getNoticeList", base.GetNoticeList, authFunc)
	group.POST("/notice/getLatestNotice", base.GetLatestNotice, authFunc)

	//广告
	group.POST("/ads/getAdLocation", base.GetAdLocation)
	group.POST("/ads/getAds", base.GetAds)
	group.POST("/ads/getLaunchAd", base.GetLaunchAd)
	group.POST("/ads/getHomeScrollAd", base.GetHomeScrollAd)
	group.POST("/ads/getHomePopAd", base.GetHomePopAd)
	group.POST("/ads/getNavBg", base.GetNavBg)
	group.POST("/ads/getHomeBannerBg", base.GetHomeBannerBg)

	//PC用，带有广告关键字，装了屏蔽广告插件的用户会报
	group.POST("/home/getAdLocation", base.GetAdLocation)
	//group.POST("/home/getLaunchAd", base.GetLaunchAd)
	//group.POST("/home/getHomeScrollAd", base.GetHomeScrollAd)
	//group.POST("/home/getHomePopAd", base.GetHomePopAd)
	group.POST("/home/getNavBg", base.GetNavBg)
	group.POST("/home/getLongMenBg", base.GetHomeBannerBg)
	group.POST("/home/getLongMenAg", base.GetAds)
	group.POST("/home/getHomeScrollLongMen", base.GetHomeScrollAd)
	group.POST("/home/getLaunchLongMen", base.GetLaunchAd)
	group.POST("/home/getHomePopLongMen", base.GetHomePopAd)

	//帮助
	group.POST("/help/getHelpById", base.GetHelpById)
	group.POST("/help/getHelpList", base.GetHelpList)

	//首页推荐
	group.POST("/home/getNewHomeData", base.GetNewHomeData)
	group.POST("/home/m/getHomeData", base.MGetHomeData)                      //android
	group.POST("/home/getHomeUserRecLive", base.GetHomeUserRecLive, authFunc) // 首页推荐主播

	//更新
	group.POST("/upgrade/detail", base.UpgradeDetail)

	//配置
	group.POST("/config/getCommonConfig", base.GetCommonConfig)
	group.POST("/config/getAndroidPatch", base.GetAndroidPatch)

	group.POST("/contents/getContents", base.GetProtocolList)
	group.POST("/contents/view", base.GetProtocolById)

	//意见反馈
	group.POST("/contents/SendFeedback", base.SendFeedback, authFunc) //意见反馈
	group.POST("/moment/SendFeedback", base.SendFeedback, authFunc)   //意见反馈

	//统计
	group.POST("/statistics/setCache", base.SetCache)
	group.POST("/statistics/downloadTimes", base.DownloadTimes)
	group.POST("/statistics/AscribeReport", base.AscribeReport)
	group.POST("/statistics/AscribeTransform", base.AscribeTransform)
	group.GET("/statistics/AscribeContact", base.AscribeContact)
	group.POST("/statistics/RetentionsDays", base.RetentionDays)

	// 登录弹窗统计
	group.POST("/dialog/inc", base.DialogCallback)

	// 跳转
	group.POST("/transit", base.Transit)
	group.POST("/transit_open", base.TransitOpen)

	// 上传服务
	group.POST("/uploader", base.Uploader)
	group.Static("/uploads", "../../../uploads")
}
